package com.demo2.servlet;

import com.minicat.servlet.HttpServlet;
import com.minicat.servlet.Request;
import com.minicat.servlet.Response;
import com.utils.HttpProtocolMocker;

import java.io.IOException;

/**
 * @author liangzj
 * @date 2021/4/10 21:33
 */
public class IntroduceServlet extends HttpServlet {
    @Override
    public void doGet(Request request, Response response) {
        doPost(request, response);
    }

    @Override
    public void doPost(Request request, Response response) {
        String data = "hello!! I am demo2";
        try {
            response.outputHttpContent(data);
        } catch (IOException e) {
            try {
                response.outputContent(HttpProtocolMocker.mockHttpHeader404());
            } catch (IOException ioException) {
                ioException.printStackTrace();
            }
        }
    }
}
